<?php

/**
 * AbetStudent form base class.
 *
 * @method AbetStudent getObject() Returns the current form's model object
 *
 * @package    sfproject
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseAbetStudentForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'abet_team_id'       => new sfWidgetFormPropelChoice(array('model' => 'AbetTeam', 'add_empty' => true)),
      'abet_department_id' => new sfWidgetFormPropelChoice(array('model' => 'AbetDepartment', 'add_empty' => true)),
      'stu_code'           => new sfWidgetFormInputText(),
      'first_name'         => new sfWidgetFormInputText(),
      'mid_name'           => new sfWidgetFormInputText(),
      'grand_name'         => new sfWidgetFormInputText(),
      'last_name'          => new sfWidgetFormInputText(),
      'start_date'         => new sfWidgetFormDate(),
      'level_number'       => new sfWidgetFormInputText(),
      'gpa'                => new sfWidgetFormInputText(),
      'email'              => new sfWidgetFormInputText(),
      'phone'              => new sfWidgetFormInputText(),
      'mobile'             => new sfWidgetFormInputText(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'abet_team_id'       => new sfValidatorPropelChoice(array('model' => 'AbetTeam', 'column' => 'id', 'required' => false)),
      'abet_department_id' => new sfValidatorPropelChoice(array('model' => 'AbetDepartment', 'column' => 'id', 'required' => false)),
      'stu_code'           => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'first_name'         => new sfValidatorString(array('max_length' => 20)),
      'mid_name'           => new sfValidatorString(array('max_length' => 20)),
      'grand_name'         => new sfValidatorString(array('max_length' => 20)),
      'last_name'          => new sfValidatorString(array('max_length' => 20)),
      'start_date'         => new sfValidatorDate(),
      'level_number'       => new sfValidatorString(array('max_length' => 2)),
      'gpa'                => new sfValidatorNumber(),
      'email'              => new sfValidatorString(array('max_length' => 30)),
      'phone'              => new sfValidatorString(array('max_length' => 9)),
      'mobile'             => new sfValidatorString(array('max_length' => 10)),
      'created_at'         => new sfValidatorDateTime(array('required' => false)),
      'updated_at'         => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'AbetStudent', 'column' => array('stu_code')))
    );

    $this->widgetSchema->setNameFormat('abet_student[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'AbetStudent';
  }


}
